
pre[class*='language-'] > code {
  background: none;
  color: var(--code-color);
  font-family: var(--font-family-code);
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-wrap: normal;
  word-break: normal;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  hyphens: none;
  transition: color var(--color-transition);
}

/* Code blocks */
pre[class*='language-'] {
  overflow: auto;
}

/* Inline code */
:not(pre) > code[class*='language-'] {
  padding: 0.1em;
  border-radius: 0.3em;
  white-space: normal;
}

{$contentClass} {
  pre, pre[class*='language-'] {
    overflow: auto;
    margin: 0.85rem 0;
    padding: 1rem;
    border-radius: 6px;
    line-height: 1.4;

    code {
      padding: 0;
      border-radius: 0;
      background: transparent !important;
      overflow-wrap: unset;
      -webkit-font-smoothing: auto;
      -moz-osx-font-smoothing: auto;
    }
  }

  .line-number {
    font-family: var(--font-family-code);
  }
}

div[class*='language-'] {
  position: relative;
  border-radius: 6px;
  background: var(--code-bg-color);
  transition: background-color var(--color-transition);

  &::before {
    position: absolute;
    top: 0.8em;
    right: 1em;
    z-index: 3;
    color: var(--code-line-color);
    font-size: 0.75rem;
    transition: color var(--color-transition);
  }

  pre, pre[class*='language-'] {
    position: relative;
    z-index: 1;
    background: transparent;
  }

  .highlight-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding-top: 1rem;
    line-height: 1.4;
    user-select: none;
  }

  .highlight-line {
    background-color: var(--code-highlight-line-color);
    transition: background-color var(--color-transition);
  }

  &.line-numbers-mode {
    &::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      z-index: 2;
      width: var(--line-numbers-width);
      height: 100%;
      border-right: 1px solid var(--code-highlight-line-color);
      border-radius: 6px 0 0 6px;
      transition: border-color var(--color-transition);

      // edited
      @media (max-width: $MQMobileNarrow) {
        border-radius: 0;
      }
    }
  }

  &.line-numbers-mode {
    .highlight-lines .highlighted {
      position: relative;

      &::before {
        content: ' ';
        position: absolute;
        top: 0;
        left: 0;
        z-index: 3;
        display: block;
        width: $lineNumbersWidth;
        height: 100%;
      }
    }

    pre {
      vertical-align: middle;
      // theme-default
      margin-left: $lineNumbersWidth;
      padding-left: 0.5rem;
    }

    .line-numbers-wrapper {
      position: absolute;
      top: 0;
      left: 0;
      width: $lineNumbersWidth;
      padding: 1rem 0;
      color: var(--code-line-color);
      line-height: 1.4;
      text-align: center;
      transition: color var(--color-transition);

      br {
        user-select: none;
      }
    }

    .line-number {
      position: relative;
      z-index: 4;
      height: 1.4em;
      font-size: 0.85em;
      user-select: none;
    }
  }

  &:not(.line-numbers-mode) {
    .line-numbers-wrapper {
      display: none;
    }
  }
}

for lang in $codeLang {
  div{'[class~="language-' + lang + '"]'} {
    &:before {
      content: '' + lang;
    }
  }
}

// narrow mobile
@media (max-width: $MQMobileNarrow) {
  {$contentClass} {
    div[class*='language-'] {
      margin: 0.85rem -1.5rem;
      border-radius: 0;
    }
  }
}
